package com.ruoyi.ob.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ob.mapper.PurchaseOrderMapper;
import com.ruoyi.ob.domain.PurchaseOrder;
import com.ruoyi.ob.service.IPurchaseOrderService;
import com.ruoyi.common.core.text.Convert;

/**
 * 采购订单主Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-18
 */
@Service
public class PurchaseOrderServiceImpl implements IPurchaseOrderService 
{
    @Autowired
    private PurchaseOrderMapper purchaseOrderMapper;

    /**
     * 查询采购订单主
     * 
     * @param orderId 采购订单主主键
     * @return 采购订单主
     */
    @Override
    public PurchaseOrder selectPurchaseOrderByOrderId(String orderId)
    {
        return purchaseOrderMapper.selectPurchaseOrderByOrderId(orderId);
    }

    /**
     * 查询采购订单主列表
     * 
     * @param purchaseOrder 采购订单主
     * @return 采购订单主
     */
    @Override
    public List<PurchaseOrder> selectPurchaseOrderList(PurchaseOrder purchaseOrder)
    {
        return purchaseOrderMapper.selectPurchaseOrderList(purchaseOrder);
    }

    /**
     * 新增采购订单主
     * 
     * @param purchaseOrder 采购订单主
     * @return 结果
     */
    @Override
    public int insertPurchaseOrder(PurchaseOrder purchaseOrder)
    {
        purchaseOrder.setCreateTime(DateUtils.getNowDate());
        return purchaseOrderMapper.insertPurchaseOrder(purchaseOrder);
    }

    /**
     * 修改采购订单主
     * 
     * @param purchaseOrder 采购订单主
     * @return 结果
     */
    @Override
    public int updatePurchaseOrder(PurchaseOrder purchaseOrder)
    {
        purchaseOrder.setUpdateTime(DateUtils.getNowDate());
        return purchaseOrderMapper.updatePurchaseOrder(purchaseOrder);
    }

    /**
     * 批量删除采购订单主
     * 
     * @param orderIds 需要删除的采购订单主主键
     * @return 结果
     */
    @Override
    public int deletePurchaseOrderByOrderIds(String orderIds)
    {
        return purchaseOrderMapper.deletePurchaseOrderByOrderIds(Convert.toStrArray(orderIds));
    }

    /**
     * 删除采购订单主信息
     * 
     * @param orderId 采购订单主主键
     * @return 结果
     */
    @Override
    public int deletePurchaseOrderByOrderId(String orderId)
    {
        return purchaseOrderMapper.deletePurchaseOrderByOrderId(orderId);
    }
}
